package com.wlq.service.controller;

import com.alibaba.druid.pool.DruidDataSource;
import com.wlq.service.service.TmService;
import io.seata.rm.datasource.xa.DataSourceProxyXA;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 发起事务controller
 *
 * @author wlq
 */
@RestController
public class TmController {

    @Autowired
    TmService service;


    @GetMapping("/insert-at")
    public String insertAt(@RequestParam String name) throws InterruptedException {
        Map<String, Object> params = new HashMap<>(1);
        params.put("name", name);
        params.put("id", Math.random());
        return service.insertAt(params);
    }




}
